Skip to content

fix: raise TimeoutError on ZMQ retry exhaustion (#393)#488

Open
GaneshPatil7517 wants to merge 1 commit intoControlCore-Project:devfrom
GaneshPatil7517:fix/issue-393-zmq-retry-timeout
Open

fix: raise TimeoutError on ZMQ retry exhaustion (#393)#488
GaneshPatil7517 wants to merge 1 commit intoControlCore-Project:devfrom
GaneshPatil7517:fix/issue-393-zmq-retry-timeout

Conversation

@GaneshPatil7517
Copy link

@GaneshPatil7517 GaneshPatil7517 commented Mar 4, 2026

Summary

Fixes #393 - recv_json_with_retry returned None on exhausted retries, causing TypeError crashes in callers.

Changes (3 files, minimal diff)

concore_base.py

  1. send_json_with_retry() - raises TimeoutError (was: bare return)
  2. recv_json_with_retry() - raises TimeoutError (was: return None)
  3. read() - catches TimeoutError, sets last_read_status = "TIMEOUT", returns (default, False)
  4. write() - catches TimeoutError, logs and continues

Tests

  • test_concore.py: 4 tests (recv raises, send raises, read default, write safe)
  • test_concoredocker.py: 2 tests (read default, write safe)

All 75 tests pass locally.

Copilot AI review requested due to automatic review settings March 4, 2026 12:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #393 by changing ZeroMQ retry-exhaustion behavior to raise TimeoutError instead of returning None, and updating read()/write() call sites (plus tests) to handle the timeout gracefully and avoid downstream TypeErrors in user code.

Changes:

  • Raise TimeoutError from ZeroMQPort.send_json_with_retry() and ZeroMQPort.recv_json_with_retry() when retries are exhausted.
  • Catch TimeoutError in read() (return default + set last_read_status="TIMEOUT") and in write() (log and continue).
  • Add regression tests for timeout exhaustion behavior in both concore and concoredocker.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
concore_base.py Converts ZMQ retry exhaustion into TimeoutError and updates read()/write() to handle it safely.
tests/test_concore.py Adds regression tests for send/recv timeout exhaustion and caller handling in concore.
tests/test_concoredocker.py Adds regression tests ensuring concoredocker read/write tolerate ZMQ timeout exhaustion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

)

send_json_with_retry() and recv_json_with_retry() now raise
TimeoutError instead of silently returning None when all 5 retries
are exhausted.  read() and write() catch the new exception so callers
never see an unhandled crash.

- send_json_with_retry: raise TimeoutError (was: return)
- recv_json_with_retry: raise TimeoutError (was: return None)
- read(): except TimeoutError -> (default, False), status TIMEOUT
- read(): remove dead 'message is None' guard (now unreachable)
- write(): except TimeoutError -> log and continue
- tests: save/restore global state in try/finally to prevent leakage
- test_read_status: use TimeoutError instead of response=None

Tests added in test_concore.py and test_concoredocker.py.
All 75 tests pass.

Closes ControlCore-Project#393
@GaneshPatil7517 GaneshPatil7517 force-pushed the fix/issue-393-zmq-retry-timeout branch from 6615699 to 30ecc5e Compare March 4, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants